package com.java.basic.proxy;

import java.lang.reflect.Proxy;

public class SimpleDynamicProxy {
	
	public static void consumer(Interface inte){  
        inte.doSomething();  
        inte.somethingElse("bonbo");  
    }  
      
    public static void main(String[] args) {  
        RealObject realObject=new RealObject();  
        consumer(new RealObject());  
        System.out.println("=================");  
        Interface proxy=(Interface) Proxy.newProxyInstance(Interface.class.getClassLoader(),  
                new Class[]{Interface.class},
                new DynamicProxyHandler(realObject));  
        consumer(proxy);  
    } 

}
